<template>
  <div>
    <ul>
      <li v-for="(item,index) in arr" :key="index">{{item}}</li>
    </ul>
    <button @click="inNewBtn">插入新来的</button>
  </div>
</template>

<script>
export default {
  name: 'CodeApp',

  data() {
    return {
      arr:['甘甘','绿绿','象棋','婷婷','马保国']
    };
  },

  mounted() {
    
  },

  methods: {
    inNewBtn(){
      // splice(索引值,截取几个,修改值)
      this.arr.splice(3,0,'再见')
    }
  },
};
</script>

<style lang="scss" scoped>

</style>